{extend name='admin@public/content'}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" id="myform" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单状态</label>
        <div class="layui-input-inline">
            <select name="pay_status"  id="pay_status" lay-verify="required" class="layui-input" style="display: block;">
                <option  value="all" >-请选择-</option>
                {foreach name="orderPaystatus"  item="vo" key="k" }
                    <option value="{$k}"  {if condition="(string)$Think.get.pay_status == (string)$k"} selected="selected"{/if}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="layui-form-item layui-inline">
            <label class="layui-form-label">订单类别</label>
            <div class="layui-input-inline">
                <select name="type" id="type" lay-verify="required" class="layui-input" style="display: block;">
                    <option value="">-请选择-</option>
                    {foreach name="btype"  item="vo" key="k" }
                    <option value="{$vo}" {if condition="(string)$Think.get.type == (string)$vo"} selected="selected"{/if} >{$k}</option>
                    {/foreach}
                </select>
            </div>
        </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单时间</label>
        <div class="layui-input-inline">
            <input name="date" id='range-date' value="{$Think.get.date|default=''}" placeholder="请选择要查询的时间段" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
            <label class="layui-form-label">会员号</label>
            <div class="layui-input-inline">
                <input name="code" id="code" value="{$Think.get.code|default=''}" placeholder="请输入会员号" class="layui-input">
            </div>
        </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
    
    <div class="layui-form-item layui-inline">
        <input type="hidden" id="excel" name="excel" value="0" >
        <a class="layui-btn layui-btn-primary" style="background: gold;" id="export">导出表格</a>
    </div>

</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});
</script>
<!-- 表单搜索 结束 -->



<!--{empty name='list'}-->
<p class="help-block text-center well">没 有 记 录 哦！</p>
<!--{else}-->
<input type="hidden" value="resort" name="action">
<table class="layui-table" lay-skin="line">
    <thead>
    <tr>
        <th class='text-left nowrap'>会员编号</th>
        <th class='text-left nowrap'>充值金额</th>
        <th class='text-left nowrap'>赠送金额</th>
        <th class='text-left nowrap'>用户到账</th>
        <th class='text-left nowrap'>订单类别</th>
        <th class='text-left nowrap'>订单状态</th>
        <th class='text-left nowrap'>订单编号</th>
        <th class='text-left nowrap'>订单时间</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
    <!--{foreach $list as $key=>$vo}-->
    <tr>
        <td class='text-left nowrap'>
            {$vo.code}
        </td>
        <td class='text-left nowrap'>
            {$vo.czamount|fenToyuan}
        </td>
        <td class='text-left nowrap'>
            {$vo.gift|fenToyuan}
        </td>
        <td class='text-left nowrap'>
            {$vo.amount|fenToyuan}
        </td>

        <td class='text-left nowrap'>
                <?php echo array_search($vo['type'],$btype); ?>
            <!-- {if $vo.type == 0}初始金额{/if}
            {if $vo.type == 1}开卡充值{/if}
            {if $vo.type == 2}人工充值{/if}
            {if $vo.type == 3}微信充值{/if}
            {if $vo.type == 4}订单退款{/if} -->
        </td>
        <td class='text-left nowrap'>
            {if $vo.pay_status == 0}已付款{/if}
            {if $vo.pay_status == 2}未付款{/if}
            {if $vo.pay_status == 1}付款失败{/if}
        </td>
        <td>{$vo.order_no}</td>
        <td>{$vo.update_at}</td>
        <td></td>

    </tr>
    <!--{/foreach}-->
    </tbody>
</table>
{if isset($page)}<p>{$page|raw}</p>{/if}
<!--{/empty}-->

<script type="text/javascript">
    $(function () {

       $("#export").click(function () {
            $("#excel").val("1");
            var t = $('form').serializeArray();
            var tempArr = [];
            $.each(t, function() {
                tempArr.push(this.name + '=' + this.value);
            });
            var urlParamsStr = tempArr.join('&');
            var url=  $('form').attr("action")+"?"+urlParamsStr;
            window.open(url);  
            
       });

    });


</script>

{/block}